package com.qingcheng.consumer;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.pojo.goods.Goods;
import com.qingcheng.pojo.goods.Sku;
import com.qingcheng.pojo.goods.Spu;
import com.qingcheng.service.goods.CategoryService;
import com.qingcheng.service.goods.SpuService;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.List;

/**
 * 根据SpuId删除商品详情页
 */
public class DeletePage implements MessageListener {

    @Autowired
    private PageUtil pageUtil;

    @Override
    public void onMessage(Message message) {
        try {
            //获取传来的mapJsonString数据
            String mapJsonString = new String(message.getBody(),"UTF-8");
            System.out.println("根据SpuId删除商品详情页");
            pageUtil.deletePage(mapJsonString);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

    }
}
